package View;

import java.awt.Color;
import java.awt.Font;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Vector;

import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import Bussiness.Delete_Action;
import Bussiness.Search_Action;
import Bussiness.TableModel;
import Model.KhoaHoc;
import Model.LopHoc;
import Model.SinhVien;
import Model.Users;
import java.awt.Toolkit;
import javax.swing.JComboBox;
import java.awt.Component;
import javax.swing.JLabel;
import javax.swing.JSeparator;
import java.awt.SystemColor;
import javax.swing.border.EmptyBorder;
import javax.swing.JToolBar;

/**
 * 
 * @author Nhóm java lớp PNV2T - Nguyễn Thị Lệ Đài - Nguyễn Chí Hướng
 * 
 *         Form quản lý chính của ứng dụng Kết nối các form với nhau
 */
public class QuanLy extends javax.swing.JFrame {
	static String UserName = null;
	static String PassWord = null;
	private static Vector vecHeader = null;
	private static Vector vecKhoaHoc = null;
	private static Vector vecUser = null;
	private static JComboBox cbxLop;
	private JComboBox cbxKhoa;
	private static Vector vecLopHoc = null;

	/** Creates new form Manager */
	public QuanLy(String UserName, String Password) {
		setIconImage(Toolkit.getDefaultToolkit().getImage(
				QuanLy.class.getResource("/Icon/QLSV.jpg")));
		this.UserName = UserName;
		this.PassWord = Password;
		try {
			UIManager
					.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
		} catch (UnsupportedLookAndFeelException ex) {
			ex.printStackTrace();
		} catch (IllegalAccessException ex) {
			ex.printStackTrace();
		} catch (InstantiationException ex) {
			ex.printStackTrace();
		} catch (ClassNotFoundException ex) {
			ex.printStackTrace();
		}
		initComponents();
		setPanel();
		setLocation(260, 30);
		lbl_UserName.setText(getUser().getTenXacNhan());
		lbl_HomNay.setText("Hôm nay là ngày : " + now("dd-MM-yyyy"));
	}

	private Users getUser() {
		Search_Action sa = new Search_Action();
		Users user = sa.getUser(UserName, PassWord);
		return user;
	}

	/**
	 * List courses and set to table
	 */
	public static void Add_DanhSachKhoaHoc() {
		Search_Action sa = new Search_Action();
		vecKhoaHoc = sa.DanhSachKhoaHoc();

		vecHeader = new Vector();
		vecHeader.add("Danh sách khóa học");
		TableModel absModel = new TableModel(vecKhoaHoc, vecHeader,
				TableModel.Type_DanhSachKhoaHoc);

		tbl_DanhSachKhoaHoc.setModel(absModel);
		tbl_DanhSachKhoaHoc.setRowHeight(30);

		sa.Close();
	}

	/**
	 * List user and set to table
	 */
	public static void Add_DanhSachUser() {
		Search_Action sa = new Search_Action();
		vecUser = sa.DanhSachNguoiDung();

		vecHeader = new Vector();
		vecHeader.add("Người dùng");
		TableModel absModel = new TableModel(vecUser, vecHeader,
				TableModel.Type_DanhSachUser);

		tbl_DanhSachNguoiDung.setModel(absModel);
		tbl_DanhSachNguoiDung.setRowHeight(30);

		sa.Close();
	}

	/**
	 * List class and set to table
	 * 
	 * @param type
	 *            : Suppose is "aaa" to search and order by course
	 * 
	 */
	public static void Add_DanhSachLopHoc(int type) {
		Search_Action sa = new Search_Action();
		vecLopHoc = sa.DanhSachLopHoc(type, 0);

		vecHeader = new Vector();
		vecHeader.add("Danh sách lớp học");
		TableModel absModel = new TableModel(vecLopHoc, vecHeader,
				TableModel.Type_DanhSachLopHoc);

		tbl_DanhSachLop.setModel(absModel);
		tbl_DanhSachLop.setRowHeight(30);

		sa.Close();
	}

	/**
	 * Set list detail of class
	 * 
	 * @param type
	 * @param MaKhoa
	 * @param KeyName
	 */
	public static void Add_DanhSachLopHocChiTiet(int type, int MaKhoa,
			String KeyName) {
		Search_Action sa = new Search_Action();
		Vector vec = sa.DanhSachLopHocChiTiet(type, MaKhoa, KeyName);

		vecHeader = new Vector();
		vecHeader.add("ID");
		vecHeader.add("Tên lớp");
		vecHeader.add("Hệ đào tạo");
		vecHeader.add("Chủ nhiệm");
		vecHeader.add("Lớp trưởng");
		TableModel absModel = new TableModel(vec, vecHeader,
				TableModel.Type_DanhSachLopHocChiTiet);

		tbl_DanhSachLopChiTiet.setModel(absModel);
		tbl_DanhSachLopChiTiet.setRowHeight(30);

		sa.Close();
	}

	/**
	 * Set list student
	 * 
	 * @param type
	 * @param MaLop
	 * @param KeyName
	 *            : Suppose is "aaa" to search for all student
	 */
	public static void Add_DanhSachSinhVien(int type, int MaLop, String KeyName) {
		Search_Action sa = new Search_Action();
		Vector vec = sa.DanhSachSinhVien(type, MaLop, KeyName);

		vecHeader = new Vector();
		vecHeader.add("Mã SV");
		vecHeader.add("Tên");
		vecHeader.add("Quê Quán");
		vecHeader.add("Ngày Sinh");
		vecHeader.add("Giới Tính");
		vecHeader.add("Tôn Giáo");
		TableModel absModel = new TableModel(vec, vecHeader,
				TableModel.Type_DanhSachSinhVien);

		tbl_DanhSachSinhVien.setModel(absModel);
		tbl_DanhSachSinhVien.setRowHeight(30);

		sa.Close();
	}

	/**
	 * Get date of system
	 * 
	 * @param dateFormat
	 * @return
	 */
	public String now(String dateFormat) {
		Calendar cal = Calendar.getInstance();
		SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
		return sdf.format(cal.getTime());
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	// <editor-fold defaultstate="collapsed"
	// desc=" Generated Code ">//GEN-BEGIN:initComponents
	public void initComponents() {
		cbxSearchStudent = new JComboBox();
		btnGR_SapXepLop = new javax.swing.ButtonGroup();
		btnGR_TimKiemLop = new javax.swing.ButtonGroup();
		jPanel1 = new javax.swing.JPanel();
		jToolBar1 = new javax.swing.JToolBar();
		jLabel1 = new javax.swing.JLabel();
		btn_Thoat1 = new javax.swing.JButton();
		btn_GioiThieu = new javax.swing.JButton();
		jLabel2 = new javax.swing.JLabel();
		jLabel3 = new javax.swing.JLabel();
		lbl_UserName = new javax.swing.JLabel();
		jPanel2 = new javax.swing.JPanel();
		jPanel3 = new javax.swing.JPanel();
		lbl_TenDieuKhien = new javax.swing.JLabel();
		jPanel4 = new javax.swing.JPanel();
		pnl_User = new javax.swing.JPanel();
		pnl_KhoaHoc = new javax.swing.JPanel();
		jScrollPane1 = new javax.swing.JScrollPane();
		tbl_DanhSachKhoaHoc = new javax.swing.JTable();
		jToolBar3 = new javax.swing.JToolBar();
		btn_ThemKhoaHoc = new javax.swing.JButton();
		jLabel12 = new javax.swing.JLabel();
		btn_XoaKhoaHoc = new javax.swing.JButton();
		jToolBar4 = new javax.swing.JToolBar();
		btn_SuaKhoaHoc = new javax.swing.JButton();
		pnl_LopHoc = new javax.swing.JPanel();
		jLabel4 = new javax.swing.JLabel();
		jScrollPane2 = new javax.swing.JScrollPane();
		tbl_DanhSachLop = new javax.swing.JTable();
		rdBtn_KhoaHoc = new javax.swing.JRadioButton();
		rdBtn_HeDaoTao = new javax.swing.JRadioButton();
		jPanel5 = new javax.swing.JPanel();
		jPanel6 = new javax.swing.JPanel();
		jLabel5 = new javax.swing.JLabel();
		jPanel7 = new javax.swing.JPanel();
		btn_User = new javax.swing.JButton();
		btn_KhoaHoc = new javax.swing.JButton();
		btn_LopHoc = new javax.swing.JButton();
		btn_MonHoc = new javax.swing.JButton();
		jPanel8 = new javax.swing.JPanel();
		jLabel6 = new javax.swing.JLabel();
		lbl_HomNay = new javax.swing.JLabel();
		jPanel9 = new javax.swing.JPanel();
		pnl_Default = new javax.swing.JPanel();
		jLabel11 = new javax.swing.JLabel();
		jSeparator1 = new javax.swing.JSeparator();
		pnl_DanhSachLop = new javax.swing.JPanel();
		jLabel8 = new javax.swing.JLabel();
		lbl_KhoaHoc = new javax.swing.JLabel();
		jToolBar2 = new javax.swing.JToolBar();
		btn_ThemLopHoc = new javax.swing.JButton();
		jLabel9 = new javax.swing.JLabel();
		btn_SuaLopHoc = new javax.swing.JButton();
		jLabel17 = new javax.swing.JLabel();
		btn_XoaLopHoc = new javax.swing.JButton();
		// rdBtn_TenLop = new javax.swing.JRadioButton();
		// rdBtn_ChuNhiem = new javax.swing.JRadioButton();
		// rdBtn_LopTruong = new javax.swing.JRadioButton();
		txt_TimLopHoc = new javax.swing.JTextField();
		btn_TimKiemLop = new javax.swing.JButton();
		jScrollPane3 = new javax.swing.JScrollPane();
		tbl_DanhSachLopChiTiet = new javax.swing.JTable();
		pnl_DanhSachSinhVien = new javax.swing.JPanel();
		jLabel13 = new javax.swing.JLabel();
		lbl_TenLop = new javax.swing.JLabel();
		jToolBar5 = new javax.swing.JToolBar();
		jLabel15 = new javax.swing.JLabel();
		txt_TimSinhVien = new javax.swing.JTextField();
		btn_TimKiemSinhVien = new javax.swing.JButton();
		btn_XemDiem = new javax.swing.JButton();
		jScrollPane4 = new javax.swing.JScrollPane();
		tbl_DanhSachSinhVien = new javax.swing.JTable();

		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setTitle("Quản lý sinh viên");
		setResizable(false);
		jPanel1.setBackground(new java.awt.Color(227, 239, 249));
		jToolBar1.setBackground(new java.awt.Color(227, 239, 249));
		jToolBar1.setBorder(javax.swing.BorderFactory
				.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
		jToolBar1.setFloatable(false);
		jLabel1.setForeground(new java.awt.Color(227, 239, 249));
		jLabel1.setText("...");
		jToolBar1.add(jLabel1);

		btn_Thoat1.setBackground(new java.awt.Color(227, 239, 249));
		btn_Thoat1.setFont(new java.awt.Font("Times New Roman", 1, 13));
		btn_Thoat1.setForeground(new java.awt.Color(102, 102, 0));
		btn_Thoat1.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/Icon/Logout_22.png")));
		btn_Thoat1.setText("Đăng xuất");
		btn_Thoat1.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btn_Thoat1ActionPerformed(evt);
			}
		});

		jToolBar1.add(btn_Thoat1);

		btn_GioiThieu.setBackground(new java.awt.Color(227, 239, 249));
		btn_GioiThieu.setFont(new java.awt.Font("Times New Roman", 1, 13));
		btn_GioiThieu.setForeground(new java.awt.Color(102, 102, 0));
		btn_GioiThieu.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/Icon/GioiThieu_22.png")));
		btn_GioiThieu.setText("Giới thiệu");
		btn_GioiThieu.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btn_GioiThieuActionPerformed(evt);
			}
		});

		label = new JLabel();
		label.setText(" | ");
		label.setForeground(new Color(133, 129, 129));
		jToolBar1.add(label);

		jToolBar1.add(btn_GioiThieu);

		jLabel2.setForeground(new java.awt.Color(133, 129, 129));
		jLabel2.setText(" | ");
		jToolBar1.add(jLabel2);

		jLabel3.setFont(new java.awt.Font("Times New Roman", 0, 13));
		jLabel3.setForeground(Color.BLUE);
		jLabel3.setText("Người sử dụng : ");
		jToolBar1.add(jLabel3);

		lbl_UserName.setFont(new java.awt.Font("Times New Roman", 1, 13));
		lbl_UserName.setForeground(new java.awt.Color(204, 0, 0));
		lbl_UserName.setText("Username");
		jToolBar1.add(lbl_UserName);

		jPanel2.setBorder(javax.swing.BorderFactory
				.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
		jPanel2.setOpaque(false);
		jPanel3.setBackground(new java.awt.Color(153, 204, 255));
		jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder());
		jPanel3.setForeground(new java.awt.Color(255, 255, 255));
		lbl_TenDieuKhien.setFont(new java.awt.Font("Times New Roman", 1, 14));
		lbl_TenDieuKhien.setForeground(new java.awt.Color(153, 0, 153));
		lbl_TenDieuKhien
				.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
		lbl_TenDieuKhien.setText("Quản lý người dùng");

		javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(
				jPanel3);
		jPanel3.setLayout(jPanel3Layout);
		jPanel3Layout.setHorizontalGroup(jPanel3Layout.createParallelGroup(
				javax.swing.GroupLayout.Alignment.LEADING).addComponent(
				lbl_TenDieuKhien, javax.swing.GroupLayout.PREFERRED_SIZE, 186,
				javax.swing.GroupLayout.PREFERRED_SIZE));
		jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(
				javax.swing.GroupLayout.Alignment.LEADING).addComponent(
				lbl_TenDieuKhien, javax.swing.GroupLayout.DEFAULT_SIZE, 31,
				Short.MAX_VALUE));

		jPanel4.setLayout(new java.awt.CardLayout());

		jPanel4.setOpaque(false);
		pnl_User.setOpaque(false);

		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setBackground(Color.WHITE);

		button_2 = new JButton();
		button_2.setIcon(new ImageIcon(QuanLy.class
				.getResource("/Icon/edit_22.png")));
		button_2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				btn_SuaNguoiDungActionPerformed(arg0);
			}
		});
		button_2.setText("Sửa         ");
		button_2.setOpaque(false);
		button_2.setFont(new Font("Times New Roman", Font.BOLD, 13));
		javax.swing.GroupLayout gl_pnl_User = new javax.swing.GroupLayout(
				pnl_User);
		gl_pnl_User.setHorizontalGroup(gl_pnl_User.createParallelGroup(
				Alignment.TRAILING).addGroup(
				Alignment.LEADING,
				gl_pnl_User
						.createSequentialGroup()
						.addGroup(
								gl_pnl_User
										.createParallelGroup(
												Alignment.TRAILING, false)
										.addComponent(button_2,
												Alignment.LEADING,
												GroupLayout.DEFAULT_SIZE,
												GroupLayout.DEFAULT_SIZE,
												Short.MAX_VALUE)
										.addComponent(scrollPane,
												Alignment.LEADING,
												GroupLayout.DEFAULT_SIZE, 188,
												Short.MAX_VALUE))
						.addContainerGap(2, Short.MAX_VALUE)));
		gl_pnl_User.setVerticalGroup(gl_pnl_User.createParallelGroup(
				Alignment.TRAILING).addGroup(
				gl_pnl_User
						.createSequentialGroup()
						.addComponent(button_2, GroupLayout.DEFAULT_SIZE, 32,
								Short.MAX_VALUE)
						.addPreferredGap(ComponentPlacement.RELATED)
						.addComponent(scrollPane, GroupLayout.PREFERRED_SIZE,
								262, GroupLayout.PREFERRED_SIZE)));

		tbl_DanhSachNguoiDung = new JTable();
		tbl_DanhSachNguoiDung.setModel(new javax.swing.table.DefaultTableModel(
				new Object[][] { { null }, }, new String[] { "Người dùng" }) {
			Class[] types = new Class[] { java.lang.String.class };
			boolean[] canEdit = new boolean[] { false };

			public Class getColumnClass(int columnIndex) {
				return types[columnIndex];
			}

			public boolean isCellEditable(int rowIndex, int columnIndex) {
				return canEdit[columnIndex];
			}
		});
		scrollPane.setViewportView(tbl_DanhSachNguoiDung);
		pnl_User.setLayout(gl_pnl_User);
		jPanel4.add(pnl_User, "card4");

		pnl_KhoaHoc.setOpaque(false);
		jScrollPane1.setBackground(new java.awt.Color(255, 255, 255));
		tbl_DanhSachKhoaHoc
				.setFont(new java.awt.Font("Times New Roman", 0, 14));
		tbl_DanhSachKhoaHoc.setModel(new javax.swing.table.DefaultTableModel(
				new Object[][] { { null }, },
				new String[] { "Danh sách khóa học" }) {
			Class[] types = new Class[] { java.lang.String.class };
			boolean[] canEdit = new boolean[] { false };

			public Class getColumnClass(int columnIndex) {
				return types[columnIndex];
			}

			public boolean isCellEditable(int rowIndex, int columnIndex) {
				return canEdit[columnIndex];
			}
		});
		tbl_DanhSachKhoaHoc.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mouseClicked(java.awt.event.MouseEvent evt) {
				tbl_DanhSachKhoaHocMouseClicked(evt);
			}
		});

		jScrollPane1.setViewportView(tbl_DanhSachKhoaHoc);

		jToolBar3.setFloatable(false);
		jToolBar3.setOpaque(false);
		btn_ThemKhoaHoc.setFont(new java.awt.Font("Times New Roman", 1, 13));
		btn_ThemKhoaHoc.setIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/Icon/Them.png")));
		btn_ThemKhoaHoc.setText("Thêm M\u1edbi");
		btn_ThemKhoaHoc.setOpaque(false);
		btn_ThemKhoaHoc.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btn_ThemKhoaHocActionPerformed(evt);
			}
		});

		jToolBar3.add(btn_ThemKhoaHoc);

		jLabel12.setText("   |   ");
		jToolBar3.add(jLabel12);

		btn_XoaKhoaHoc.setFont(new java.awt.Font("Times New Roman", 1, 13));
		btn_XoaKhoaHoc.setIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/Icon/Xoa_22.png")));
		btn_XoaKhoaHoc.setText("Xóa   ");
		btn_XoaKhoaHoc.setOpaque(false);
		btn_XoaKhoaHoc.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btn_XoaKhoaHocActionPerformed(evt);
			}
		});

		jToolBar3.add(btn_XoaKhoaHoc);

		jToolBar4.setFloatable(false);
		jToolBar4.setOpaque(false);
		btn_SuaKhoaHoc.setFont(new java.awt.Font("Times New Roman", 1, 13));
		btn_SuaKhoaHoc.setIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/Icon/edit_22.png")));
		btn_SuaKhoaHoc.setText("Sửa         ");
		btn_SuaKhoaHoc.setOpaque(false);
		btn_SuaKhoaHoc.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btn_SuaKhoaHocActionPerformed(evt);
			}
		});

		label_1 = new JLabel("                 ");
		jToolBar4.add(label_1);

		jToolBar4.add(btn_SuaKhoaHoc);

		separator_1 = new JSeparator();

		javax.swing.GroupLayout pnl_KhoaHocLayout = new javax.swing.GroupLayout(
				pnl_KhoaHoc);
		pnl_KhoaHocLayout.setHorizontalGroup(pnl_KhoaHocLayout
				.createParallelGroup(Alignment.TRAILING)
				.addComponent(jToolBar3, GroupLayout.DEFAULT_SIZE, 190,
						Short.MAX_VALUE)
				.addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 190,
						Short.MAX_VALUE)
				.addGroup(
						pnl_KhoaHocLayout
								.createSequentialGroup()
								.addContainerGap()
								.addComponent(jToolBar4,
										GroupLayout.DEFAULT_SIZE, 170,
										Short.MAX_VALUE).addContainerGap())
				.addGroup(
						Alignment.LEADING,
						pnl_KhoaHocLayout
								.createSequentialGroup()
								.addGap(24)
								.addComponent(separator_1,
										GroupLayout.PREFERRED_SIZE, 144,
										GroupLayout.PREFERRED_SIZE)
								.addContainerGap(22, Short.MAX_VALUE)));
		pnl_KhoaHocLayout.setVerticalGroup(pnl_KhoaHocLayout
				.createParallelGroup(Alignment.LEADING).addGroup(
						pnl_KhoaHocLayout
								.createSequentialGroup()
								.addComponent(jToolBar3,
										GroupLayout.PREFERRED_SIZE,
										GroupLayout.DEFAULT_SIZE,
										GroupLayout.PREFERRED_SIZE)
								.addPreferredGap(ComponentPlacement.UNRELATED)
								.addComponent(separator_1,
										GroupLayout.PREFERRED_SIZE, 2,
										GroupLayout.PREFERRED_SIZE)
								.addPreferredGap(ComponentPlacement.RELATED)
								.addComponent(jToolBar4,
										GroupLayout.PREFERRED_SIZE,
										GroupLayout.DEFAULT_SIZE,
										GroupLayout.PREFERRED_SIZE)
								.addPreferredGap(ComponentPlacement.RELATED)
								.addComponent(jScrollPane1,
										GroupLayout.PREFERRED_SIZE, 208,
										GroupLayout.PREFERRED_SIZE)));
		pnl_KhoaHoc.setLayout(pnl_KhoaHocLayout);
		jPanel4.add(pnl_KhoaHoc, "card2");

		pnl_LopHoc.setOpaque(false);
		jLabel4.setFont(new java.awt.Font("Times New Roman", 0, 13));
		jLabel4.setText("S\u1eafp x\u1ebfp theo : ");

		tbl_DanhSachLop.setFont(new java.awt.Font("Times New Roman", 0, 14));
		tbl_DanhSachLop
				.setModel(new javax.swing.table.DefaultTableModel(
						new Object[][] { { null }, },
						new String[] { "Danh sách lớp" }) {
					Class[] types = new Class[] { java.lang.String.class };
					boolean[] canEdit = new boolean[] { false };

					public Class getColumnClass(int columnIndex) {
						return types[columnIndex];
					}

					public boolean isCellEditable(int rowIndex, int columnIndex) {
						return canEdit[columnIndex];
					}
				});
		tbl_DanhSachLop.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mouseClicked(java.awt.event.MouseEvent evt) {
				tbl_DanhSachLopMouseClicked(evt);
			}
		});

		jScrollPane2.setViewportView(tbl_DanhSachLop);

		btnGR_SapXepLop.add(rdBtn_KhoaHoc);
		rdBtn_KhoaHoc.setFont(new java.awt.Font("Times New Roman", 1, 12));
		rdBtn_KhoaHoc.setSelected(true);
		rdBtn_KhoaHoc.setText("Khóa học");
		rdBtn_KhoaHoc.setBorder(javax.swing.BorderFactory.createEmptyBorder(0,
				0, 0, 0));
		rdBtn_KhoaHoc.setMargin(new java.awt.Insets(0, 0, 0, 0));
		rdBtn_KhoaHoc.setOpaque(false);
		rdBtn_KhoaHoc.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				rdBtn_KhoaHocActionPerformed(evt);
			}
		});

		btnGR_SapXepLop.add(rdBtn_HeDaoTao);
		rdBtn_HeDaoTao.setFont(new java.awt.Font("Times New Roman", 1, 12));
		rdBtn_HeDaoTao.setText("Hệ đào tạo");
		rdBtn_HeDaoTao.setBorder(javax.swing.BorderFactory.createEmptyBorder(0,
				0, 0, 0));
		rdBtn_HeDaoTao.setMargin(new java.awt.Insets(0, 0, 0, 0));
		rdBtn_HeDaoTao.setOpaque(false);
		rdBtn_HeDaoTao.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				rdBtn_HeDaoTaoActionPerformed(evt);
			}
		});

		javax.swing.GroupLayout pnl_LopHocLayout = new javax.swing.GroupLayout(
				pnl_LopHoc);
		pnl_LopHoc.setLayout(pnl_LopHocLayout);
		pnl_LopHocLayout
				.setHorizontalGroup(pnl_LopHocLayout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								pnl_LopHocLayout.createSequentialGroup()
										.addContainerGap()
										.addComponent(jLabel4)
										.addGap(103, 103, 103))
						.addComponent(jScrollPane2,
								javax.swing.GroupLayout.DEFAULT_SIZE, 190,
								Short.MAX_VALUE)
						.addGroup(
								pnl_LopHocLayout
										.createSequentialGroup()
										.addContainerGap()
										.addComponent(rdBtn_KhoaHoc)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED,
												22, Short.MAX_VALUE)
										.addComponent(rdBtn_HeDaoTao)
										.addContainerGap()));
		pnl_LopHocLayout
				.setVerticalGroup(pnl_LopHocLayout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								pnl_LopHocLayout
										.createSequentialGroup()
										.addComponent(jLabel4)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												pnl_LopHocLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(
																rdBtn_KhoaHoc)
														.addComponent(
																rdBtn_HeDaoTao))
										.addGap(8, 8, 8)
										.addComponent(
												jScrollPane2,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												248, Short.MAX_VALUE)));
		jPanel4.add(pnl_LopHoc, "card3");

		javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(
				jPanel2);
		jPanel2.setLayout(jPanel2Layout);
		jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup(
				javax.swing.GroupLayout.Alignment.LEADING).addGroup(
				jPanel2Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.TRAILING,
								false)
						.addComponent(jPanel4,
								javax.swing.GroupLayout.Alignment.LEADING, 0,
								0, Short.MAX_VALUE)
						.addComponent(jPanel3,
								javax.swing.GroupLayout.Alignment.LEADING,
								javax.swing.GroupLayout.DEFAULT_SIZE,
								javax.swing.GroupLayout.DEFAULT_SIZE,
								Short.MAX_VALUE)));
		jPanel2Layout
				.setVerticalGroup(jPanel2Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								jPanel2Layout
										.createSequentialGroup()
										.addComponent(
												jPanel3,
												javax.swing.GroupLayout.PREFERRED_SIZE,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												javax.swing.GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addComponent(
												jPanel4,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												293, Short.MAX_VALUE)));

		jPanel5.setBorder(javax.swing.BorderFactory
				.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
		jPanel5.setOpaque(false);
		jPanel6.setBackground(new java.awt.Color(153, 204, 255));
		jPanel6.setBorder(javax.swing.BorderFactory.createEtchedBorder());
		jPanel6.setForeground(new java.awt.Color(255, 255, 255));
		jLabel5.setFont(new java.awt.Font("Times New Roman", 1, 14));
		jLabel5.setForeground(new java.awt.Color(153, 0, 153));
		jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
		jLabel5.setText("Bảng điều khiển");

		javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(
				jPanel6);
		jPanel6.setLayout(jPanel6Layout);
		jPanel6Layout.setHorizontalGroup(jPanel6Layout.createParallelGroup(
				javax.swing.GroupLayout.Alignment.LEADING).addComponent(
				jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 186,
				javax.swing.GroupLayout.PREFERRED_SIZE));
		jPanel6Layout.setVerticalGroup(jPanel6Layout.createParallelGroup(
				javax.swing.GroupLayout.Alignment.LEADING).addComponent(
				jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, 31,
				Short.MAX_VALUE));

		jPanel7.setOpaque(false);
		btn_User.setFont(new java.awt.Font("Times New Roman", 1, 13));
		btn_User.setForeground(new java.awt.Color(0, 0, 153));
		btn_User.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/Icon/System_22.png")));
		btn_User.setText("Người dùng");
		btn_User.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btn_NguoiDungActionPerformed(evt);
			}
		});

		btn_KhoaHoc.setFont(new java.awt.Font("Times New Roman", 1, 13));
		btn_KhoaHoc.setForeground(new java.awt.Color(0, 0, 153));
		btn_KhoaHoc.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/Icon/Course_22.png")));
		btn_KhoaHoc.setText("Khóa học");
		btn_KhoaHoc.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btn_KhoaHocActionPerformed(evt);
			}
		});

		btn_LopHoc.setFont(new java.awt.Font("Times New Roman", 1, 13));
		btn_LopHoc.setForeground(new java.awt.Color(0, 0, 153));
		btn_LopHoc.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/Icon/Class_22.png")));
		btn_LopHoc.setText("Lớp học");
		btn_LopHoc.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btn_LopHocActionPerformed(evt);
			}
		});

		btn_MonHoc.setFont(new java.awt.Font("Times New Roman", 1, 13));
		btn_MonHoc.setForeground(new java.awt.Color(0, 0, 153));
		btn_MonHoc.setIcon(new ImageIcon(QuanLy.class
				.getResource("/Icon/System_22.png")));
		btn_MonHoc.setText("Môn học");
		btn_MonHoc.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btn_MonHocActionPerformed(evt);
			}
		});

		btnHocSinh = new JButton();
		btnHocSinh.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				btnHocSinh();
			}
		});
		btnHocSinh.setIcon(new ImageIcon(QuanLy.class
				.getResource("/Icon/StudentsIcon.png")));
		btnHocSinh.setText("Học sinh");
		btnHocSinh.setForeground(new Color(0, 0, 153));
		btnHocSinh.setFont(new Font("Times New Roman", Font.BOLD, 13));

		javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(
				jPanel7);
		jPanel7Layout
				.setHorizontalGroup(jPanel7Layout
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								jPanel7Layout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPanel7Layout
														.createParallelGroup(
																Alignment.LEADING)
														.addComponent(
																btnHocSinh,
																GroupLayout.PREFERRED_SIZE,
																170,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																btn_User,
																GroupLayout.DEFAULT_SIZE,
																170,
																Short.MAX_VALUE)
														.addComponent(
																btn_KhoaHoc,
																GroupLayout.PREFERRED_SIZE,
																170,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																btn_LopHoc,
																GroupLayout.PREFERRED_SIZE,
																170,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																btn_MonHoc,
																GroupLayout.PREFERRED_SIZE,
																170,
																GroupLayout.PREFERRED_SIZE))
										.addContainerGap()));
		jPanel7Layout.setVerticalGroup(jPanel7Layout.createParallelGroup(
				Alignment.LEADING).addGroup(
				jPanel7Layout
						.createSequentialGroup()
						.addComponent(btn_User)
						.addPreferredGap(ComponentPlacement.RELATED)
						.addComponent(btn_KhoaHoc)
						.addPreferredGap(ComponentPlacement.RELATED)
						.addComponent(btn_LopHoc)
						.addPreferredGap(ComponentPlacement.RELATED)
						.addComponent(btnHocSinh, GroupLayout.PREFERRED_SIZE,
								31, GroupLayout.PREFERRED_SIZE)
						.addPreferredGap(ComponentPlacement.RELATED)
						.addComponent(btn_MonHoc)
						.addContainerGap(12, Short.MAX_VALUE)));
		jPanel7.setLayout(jPanel7Layout);

		javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(
				jPanel5);
		jPanel5Layout.setHorizontalGroup(jPanel5Layout
				.createParallelGroup(Alignment.LEADING)
				.addComponent(jPanel6, GroupLayout.PREFERRED_SIZE,
						GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
				.addComponent(jPanel7, GroupLayout.DEFAULT_SIZE,
						GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
		jPanel5Layout.setVerticalGroup(jPanel5Layout.createParallelGroup(
				Alignment.LEADING).addGroup(
				jPanel5Layout
						.createSequentialGroup()
						.addComponent(jPanel6, GroupLayout.PREFERRED_SIZE,
								GroupLayout.DEFAULT_SIZE,
								GroupLayout.PREFERRED_SIZE)
						.addPreferredGap(ComponentPlacement.RELATED)
						.addComponent(jPanel7, GroupLayout.PREFERRED_SIZE, 191,
								GroupLayout.PREFERRED_SIZE)
						.addContainerGap(25, Short.MAX_VALUE)));
		jPanel5.setLayout(jPanel5Layout);

		jPanel8.setBackground(new java.awt.Color(192, 192, 244));
		jLabel6.setFont(new java.awt.Font("Times New Roman", 0, 13));
		jLabel6.setForeground(new java.awt.Color(51, 51, 0));
		jLabel6.setText("       Thiết kế bởi Nguyễn Thị Lệ Đài - Nguyễn Chí Hướng");

		lbl_HomNay.setFont(new java.awt.Font("Times New Roman", 0, 13));
		lbl_HomNay.setForeground(new java.awt.Color(51, 51, 0));
		lbl_HomNay.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
		lbl_HomNay.setText("Hôm nay là ngày : ");

		javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(
				jPanel8);
		jPanel8Layout.setHorizontalGroup(jPanel8Layout.createParallelGroup(
				Alignment.LEADING).addGroup(
				jPanel8Layout
						.createSequentialGroup()
						.addComponent(jLabel6, GroupLayout.PREFERRED_SIZE, 356,
								GroupLayout.PREFERRED_SIZE)
						.addPreferredGap(ComponentPlacement.RELATED, 234,
								Short.MAX_VALUE)
						.addComponent(lbl_HomNay, GroupLayout.PREFERRED_SIZE,
								317, GroupLayout.PREFERRED_SIZE).addGap(30)));
		jPanel8Layout.setVerticalGroup(jPanel8Layout.createParallelGroup(
				Alignment.LEADING).addGroup(
				jPanel8Layout
						.createParallelGroup(Alignment.BASELINE)
						.addComponent(jLabel6, GroupLayout.DEFAULT_SIZE, 22,
								Short.MAX_VALUE)
						.addComponent(lbl_HomNay, GroupLayout.PREFERRED_SIZE,
								22, GroupLayout.PREFERRED_SIZE)));
		jPanel8.setLayout(jPanel8Layout);

		jPanel9.setLayout(new java.awt.CardLayout());

		jPanel9.setBorder(new javax.swing.border.SoftBevelBorder(
				javax.swing.border.BevelBorder.LOWERED));
		jPanel9.setOpaque(false);
		pnl_Default.setOpaque(false);
		jLabel11.setFont(new java.awt.Font("Times New Roman", 1, 36));
		jLabel11.setForeground(new java.awt.Color(0, 153, 153));
		jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
		jLabel11.setText("Cám ơn đã sử dụng ứng dụng của chúng tôi!");

		javax.swing.GroupLayout pnl_DefaultLayout = new javax.swing.GroupLayout(
				pnl_Default);
		pnl_Default.setLayout(pnl_DefaultLayout);
		pnl_DefaultLayout.setHorizontalGroup(pnl_DefaultLayout
				.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE,
						731, Short.MAX_VALUE)
				.addGroup(
						pnl_DefaultLayout
								.createSequentialGroup()
								.addGap(112, 112, 112)
								.addComponent(jSeparator1,
										javax.swing.GroupLayout.PREFERRED_SIZE,
										517,
										javax.swing.GroupLayout.PREFERRED_SIZE)
								.addContainerGap()));
		pnl_DefaultLayout
				.setVerticalGroup(pnl_DefaultLayout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								pnl_DefaultLayout
										.createSequentialGroup()
										.addGap(91, 91, 91)
										.addComponent(jLabel11)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addComponent(
												jSeparator1,
												javax.swing.GroupLayout.PREFERRED_SIZE,
												10,
												javax.swing.GroupLayout.PREFERRED_SIZE)
										.addContainerGap(398, Short.MAX_VALUE)));
		jPanel9.add(pnl_Default, "card3");

		pnl_DanhSachLop.setOpaque(false);
		jLabel8.setFont(new java.awt.Font("Times New Roman", 1, 20));
		jLabel8.setForeground(new java.awt.Color(204, 0, 204));
		jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
		jLabel8.setText("Danh sách lớp của ");

		lbl_KhoaHoc.setFont(new java.awt.Font("Times New Roman", 1, 20));
		lbl_KhoaHoc.setForeground(new java.awt.Color(102, 0, 0));
		lbl_KhoaHoc.setText("Khóa học");

		jToolBar2.setBorder(null);
		jToolBar2.setFloatable(false);
		jToolBar2.setOpaque(false);
		btn_ThemLopHoc.setFont(new java.awt.Font("Times New Roman", 1, 13));
		btn_ThemLopHoc.setIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/Icon/Them.png")));
		btn_ThemLopHoc.setText("Thêm");
		btn_ThemLopHoc.setOpaque(false);
		btn_ThemLopHoc.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btn_ThemLopHocActionPerformed(evt);
			}
		});

		jToolBar2.add(btn_ThemLopHoc);

		jLabel9.setFont(new java.awt.Font("Times New Roman", 1, 14));
		jLabel9.setForeground(new java.awt.Color(187, 183, 183));
		jLabel9.setText(" | ");
		jToolBar2.add(jLabel9);

		btn_SuaLopHoc.setFont(new java.awt.Font("Times New Roman", 1, 13));
		btn_SuaLopHoc.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/Icon/edit_22.png")));
		btn_SuaLopHoc.setText("Sửa");
		btn_SuaLopHoc.setOpaque(false);
		btn_SuaLopHoc.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btn_SuaLopHocActionPerformed(evt);
			}
		});

		jToolBar2.add(btn_SuaLopHoc);

		jLabel17.setFont(new java.awt.Font("Times New Roman", 1, 14));
		jLabel17.setForeground(new java.awt.Color(187, 183, 183));
		jLabel17.setText(" | ");
		jToolBar2.add(jLabel17);

		btn_XoaLopHoc.setFont(new java.awt.Font("Times New Roman", 1, 13));
		btn_XoaLopHoc.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/Icon/Xoa_22.png")));
		btn_XoaLopHoc.setText("Xóa");
		btn_XoaLopHoc.setOpaque(false);
		btn_XoaLopHoc.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btn_XoaLopHocActionPerformed(evt);
			}
		});

		jToolBar2.add(btn_XoaLopHoc);

		lblTmLp = new JLabel("            Tìm lớp:    ");
		lblTmLp.setFont(new Font("Tahoma", Font.BOLD, 13));
		jToolBar2.add(lblTmLp);

		// btnGR_TimKiemLop.add(rdBtn_TenLop);
		// rdBtn_TenLop.setFont(new java.awt.Font("Times New Roman", 0, 13));
		// rdBtn_TenLop.setSelected(true);
		// rdBtn_TenLop.setText("T\u00ean lớp    ");
		// rdBtn_TenLop.setBorder(javax.swing.BorderFactory.createEmptyBorder(0,
		// 0, 0, 0));
		// rdBtn_TenLop.setMargin(new java.awt.Insets(0, 0, 0, 0));
		// rdBtn_TenLop.setOpaque(false);
		// jToolBar2.add(rdBtn_TenLop);
		//
		// btnGR_TimKiemLop.add(rdBtn_ChuNhiem);
		// rdBtn_ChuNhiem.setFont(new java.awt.Font("Times New Roman", 0, 13));
		// rdBtn_ChuNhiem.setText(" Chủ nhiệm   ");
		// rdBtn_ChuNhiem.setBorder(javax.swing.BorderFactory.createEmptyBorder(0,
		// 0, 0, 0));
		// rdBtn_ChuNhiem.setMargin(new java.awt.Insets(0, 0, 0, 0));
		// rdBtn_ChuNhiem.setOpaque(false);
		// jToolBar2.add(rdBtn_ChuNhiem);
		//
		// btnGR_TimKiemLop.add(rdBtn_LopTruong);
		// rdBtn_LopTruong.setFont(new java.awt.Font("Times New Roman", 0, 13));
		// rdBtn_LopTruong.setText("Lớp trưởng        ");
		// rdBtn_LopTruong.setBorder(javax.swing.BorderFactory.createEmptyBorder(
		// 0, 0, 0, 0));
		// rdBtn_LopTruong.setMargin(new java.awt.Insets(0, 0, 0, 0));
		// rdBtn_LopTruong.setOpaque(false);
		// jToolBar2.add(rdBtn_LopTruong);

		txt_TimLopHoc.setFont(new java.awt.Font("Times New Roman", 0, 13));
		jToolBar2.add(txt_TimLopHoc);

		btn_TimKiemLop.setFont(new java.awt.Font("Times New Roman", 1, 13));
		btn_TimKiemLop.setIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/Icon/TimKiem.png")));
		btn_TimKiemLop.setText("  T\u00ecm");
		btn_TimKiemLop.setOpaque(false);
		btn_TimKiemLop.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btn_TimKiemLopActionPerformed(evt);
			}
		});

		cbxSearchStudent.addItem("Tên lớp");
		cbxSearchStudent.addItem("Chủ nhiệm");
		cbxSearchStudent.addItem("Lớp trưởng");
		cbxSearchStudent.setSelectedIndex(0);
		jToolBar2.add(cbxSearchStudent);

		jToolBar2.add(btn_TimKiemLop);

		tbl_DanhSachLopChiTiet

		.setModel(new javax.swing.table.DefaultTableModel(new Object[][] { {
				null, null, null, null, null }
		// ,
		// { null, null, null, null, null },
		// { null, null, null, null, null },
		// { null, null, null, null, null }
				}, new String[] { "ID", "Tên lớp", "Hệ đào tạo", "Chủ nhiệm",
						"Lớp trưởng" }) {
			Class[] types = new Class[] { java.lang.Integer.class,
					java.lang.String.class, java.lang.String.class,
					java.lang.String.class, java.lang.String.class };
			boolean[] canEdit = new boolean[] { false, false, false, false,
					false };

			public Class getColumnClass(int columnIndex) {
				return types[columnIndex];
			}

			public boolean isCellEditable(int rowIndex, int columnIndex) {
				return canEdit[columnIndex];
			}
		});
		// tbl_DanhSachLopChiTiet
		// .addMouseListener(new java.awt.event.MouseAdapter() {
		// public void mouseClicked(java.awt.event.MouseEvent evt) {
		// tbl_DanhSachLopChiTietMouseClicked(evt);
		// }
		// });

		jScrollPane3.setViewportView(tbl_DanhSachLopChiTiet);

		javax.swing.GroupLayout pnl_DanhSachLopLayout = new javax.swing.GroupLayout(
				pnl_DanhSachLop);
		pnl_DanhSachLop.setLayout(pnl_DanhSachLopLayout);
		pnl_DanhSachLopLayout
				.setHorizontalGroup(pnl_DanhSachLopLayout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								pnl_DanhSachLopLayout
										.createSequentialGroup()
										.addGap(63, 63, 63)
										.addComponent(
												jLabel8,
												javax.swing.GroupLayout.PREFERRED_SIZE,
												329,
												javax.swing.GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addComponent(
												lbl_KhoaHoc,
												javax.swing.GroupLayout.PREFERRED_SIZE,
												171,
												javax.swing.GroupLayout.PREFERRED_SIZE)
										.addContainerGap(162, Short.MAX_VALUE))
						.addGroup(
								pnl_DanhSachLopLayout
										.createSequentialGroup()
										.addContainerGap()
										.addComponent(
												jToolBar2,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												721, Short.MAX_VALUE))
						.addGroup(
								pnl_DanhSachLopLayout
										.createSequentialGroup()
										.addContainerGap()
										.addComponent(
												jScrollPane3,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												711, Short.MAX_VALUE)
										.addContainerGap()));
		pnl_DanhSachLopLayout
				.setVerticalGroup(pnl_DanhSachLopLayout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								pnl_DanhSachLopLayout
										.createSequentialGroup()
										.addGroup(
												pnl_DanhSachLopLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(
																jLabel8,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																40,
																javax.swing.GroupLayout.PREFERRED_SIZE)
														.addComponent(
																lbl_KhoaHoc,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																40,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addComponent(
												jToolBar2,
												javax.swing.GroupLayout.PREFERRED_SIZE,
												32,
												javax.swing.GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addComponent(
												jScrollPane3,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												463, Short.MAX_VALUE)));
		jPanel9.add(pnl_DanhSachLop, "card2");

		pnl_DanhSachSinhVien.setOpaque(false);
		jLabel13.setFont(new java.awt.Font("Times New Roman", 1, 20));
		jLabel13.setForeground(new java.awt.Color(204, 0, 204));
		jLabel13.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
		jLabel13.setText("Danh sách sinh viên lớp ");

		lbl_TenLop.setFont(new java.awt.Font("Times New Roman", 1, 20));
		lbl_TenLop.setForeground(new java.awt.Color(102, 0, 0));
		lbl_TenLop.setText("lớp");

		jToolBar5.setBorder(null);
		jToolBar5.setFloatable(false);
		jToolBar5.setOpaque(false);

		jLabel15.setFont(new java.awt.Font("Times New Roman", 1, 14));
		jLabel15.setForeground(new java.awt.Color(187, 183, 183));
		jLabel15.setText("    ");
		jToolBar5.add(jLabel15);

		lblTmSinhVin = new JLabel("Tìm sinh viên:       ");
		lblTmSinhVin.setFont(new Font("Tahoma", Font.BOLD, 11));
		jToolBar5.add(lblTmSinhVin);

		txt_TimSinhVien.setFont(new java.awt.Font("Times New Roman", 0, 13));
		jToolBar5.add(txt_TimSinhVien);

		btn_TimKiemSinhVien
				.setFont(new java.awt.Font("Times New Roman", 1, 13));
		btn_TimKiemSinhVien.setIcon(new javax.swing.ImageIcon(getClass()
				.getResource("/Icon/TimKiem.png")));
		btn_TimKiemSinhVien.setText("Tìm");
		btn_TimKiemSinhVien.setOpaque(false);
		btn_TimKiemSinhVien
				.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(java.awt.event.ActionEvent evt) {
						btn_TimKiemSinhVienActionPerformed(evt);
					}
				});

		cbxSearchClass = new JComboBox();
		cbxSearchClass.setAlignmentX(2.0f);
		cbxSearchClass.addItem("Mã SV");
		cbxSearchClass.addItem("Tên SV");

		jToolBar5.add(cbxSearchClass);

		jToolBar5.add(btn_TimKiemSinhVien);

		btn_XemDiem.setFont(new java.awt.Font("Times New Roman", 1, 13));
		btn_XemDiem.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/Icon/month_22.png")));
		btn_XemDiem.setText("Xem Điểm");
		btn_XemDiem.setOpaque(false);
		btn_XemDiem.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				try {
					btn_XemDiemActionPerformed(evt);
				} catch (Exception e) {
					e.printStackTrace();
					JOptionPane.showMessageDialog(null,
							"Sinh viên chưa có kết quả học tập!");
				}
			}
		});

		jToolBar5.add(btn_XemDiem);

		tbl_DanhSachSinhVien
				.setFont(new java.awt.Font("Times New Roman", 0, 13));
		tbl_DanhSachSinhVien.setModel(new javax.swing.table.DefaultTableModel(
				new Object[][] { { null, null, null, null, null, null }, },
				new String[] { "Mã SV", "Tên", "Quê Quán", "Ngày Sinh",
						"Giới Tính", "Tôn giáo" }) {
			Class[] types = new Class[] { java.lang.String.class,
					java.lang.String.class, java.lang.String.class,
					java.lang.String.class, java.lang.String.class,
					java.lang.String.class };
			boolean[] canEdit = new boolean[] { false, false, false, false,
					false, false };

			public Class getColumnClass(int columnIndex) {
				return types[columnIndex];
			}

			public boolean isCellEditable(int rowIndex, int columnIndex) {
				return canEdit[columnIndex];
			}
		});

		jScrollPane4.setViewportView(tbl_DanhSachSinhVien);

		separator = new JSeparator();

		javax.swing.GroupLayout pnl_DanhSachSinhVienLayout = new javax.swing.GroupLayout(
				pnl_DanhSachSinhVien);
		pnl_DanhSachSinhVienLayout
				.setHorizontalGroup(pnl_DanhSachSinhVienLayout
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								pnl_DanhSachSinhVienLayout
										.createSequentialGroup()
										.addComponent(jLabel13,
												GroupLayout.PREFERRED_SIZE,
												380, GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(
												ComponentPlacement.RELATED)
										.addComponent(lbl_TenLop,
												GroupLayout.PREFERRED_SIZE,
												171, GroupLayout.PREFERRED_SIZE)
										.addGap(174))
						.addGroup(
								pnl_DanhSachSinhVienLayout
										.createSequentialGroup()
										.addContainerGap()
										.addComponent(jToolBar5,
												GroupLayout.DEFAULT_SIZE, 706,
												Short.MAX_VALUE).addGap(15))
						.addGroup(
								pnl_DanhSachSinhVienLayout
										.createSequentialGroup()
										.addContainerGap()
										.addComponent(jScrollPane4,
												GroupLayout.DEFAULT_SIZE, 706,
												Short.MAX_VALUE).addGap(15))
						.addGroup(
								pnl_DanhSachSinhVienLayout
										.createSequentialGroup()
										.addContainerGap()
										.addComponent(separator,
												GroupLayout.PREFERRED_SIZE,
												704, GroupLayout.PREFERRED_SIZE)
										.addContainerGap(17, Short.MAX_VALUE)));
		pnl_DanhSachSinhVienLayout
				.setVerticalGroup(pnl_DanhSachSinhVienLayout
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								pnl_DanhSachSinhVienLayout
										.createSequentialGroup()
										.addGroup(
												pnl_DanhSachSinhVienLayout
														.createParallelGroup(
																Alignment.BASELINE)
														.addComponent(
																jLabel13,
																GroupLayout.PREFERRED_SIZE,
																40,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																lbl_TenLop,
																GroupLayout.PREFERRED_SIZE,
																40,
																GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												ComponentPlacement.RELATED)
										.addComponent(jToolBar5,
												GroupLayout.PREFERRED_SIZE, 32,
												GroupLayout.PREFERRED_SIZE)
										.addGap(7)
										.addComponent(separator,
												GroupLayout.PREFERRED_SIZE,
												GroupLayout.DEFAULT_SIZE,
												GroupLayout.PREFERRED_SIZE)
										.addGap(9)
										.addComponent(jScrollPane4,
												GroupLayout.DEFAULT_SIZE, 471,
												Short.MAX_VALUE)
										.addContainerGap()));
		pnl_DanhSachSinhVien.setLayout(pnl_DanhSachSinhVienLayout);
		jPanel9.add(pnl_DanhSachSinhVien, "card4");

		javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(
				jPanel1);
		jPanel1Layout
				.setHorizontalGroup(jPanel1Layout
						.createParallelGroup(Alignment.LEADING)
						.addComponent(jToolBar1, GroupLayout.DEFAULT_SIZE, 937,
								Short.MAX_VALUE)
						.addComponent(jPanel8, GroupLayout.DEFAULT_SIZE,
								GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
						.addGroup(
								jPanel1Layout
										.createSequentialGroup()
										.addGroup(
												jPanel1Layout
														.createParallelGroup(
																Alignment.LEADING)
														.addComponent(
																jPanel2,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE)
														.addComponent(
																jPanel5,
																GroupLayout.PREFERRED_SIZE,
																GroupLayout.DEFAULT_SIZE,
																GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												ComponentPlacement.RELATED)
										.addComponent(jPanel9,
												GroupLayout.DEFAULT_SIZE, 737,
												Short.MAX_VALUE)));
		jPanel1Layout
				.setVerticalGroup(jPanel1Layout
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								jPanel1Layout
										.createSequentialGroup()
										.addComponent(jToolBar1,
												GroupLayout.PREFERRED_SIZE, 35,
												GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(
												ComponentPlacement.RELATED)
										.addGroup(
												jPanel1Layout
														.createParallelGroup(
																Alignment.LEADING)
														.addGroup(
																jPanel1Layout
																		.createSequentialGroup()
																		.addComponent(
																				jPanel2,
																				GroupLayout.PREFERRED_SIZE,
																				GroupLayout.DEFAULT_SIZE,
																				GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				ComponentPlacement.RELATED)
																		.addComponent(
																				jPanel5,
																				GroupLayout.PREFERRED_SIZE,
																				234,
																				GroupLayout.PREFERRED_SIZE))
														.addComponent(
																jPanel9,
																GroupLayout.DEFAULT_SIZE,
																574,
																Short.MAX_VALUE))
										.addPreferredGap(
												ComponentPlacement.RELATED)
										.addComponent(jPanel8,
												GroupLayout.PREFERRED_SIZE,
												GroupLayout.DEFAULT_SIZE,
												GroupLayout.PREFERRED_SIZE)));

		pnlMonHoc = new JPanel();
		jPanel9.add(pnlMonHoc, "name_9925492577612");

		pnl_SinhVien = new JPanel();
		jPanel9.add(pnl_SinhVien, "name_1579593009263");
		pnl_SinhVien.setLayout(null);

		JPanel panel = new JPanel();
		panel.setLayout(null);
		panel.setBorder(new EmptyBorder(5, 5, 5, 5));
		panel.setBackground(SystemColor.activeCaption);
		panel.setBounds(10, 11, 711, 556);
		pnl_SinhVien.add(panel);

		JLabel label_2 = new JLabel("Quản lý sinh viên");
		label_2.setFont(new Font("Tahoma", Font.BOLD, 15));
		label_2.setBounds(273, 11, 136, 30);
		panel.add(label_2);

		JToolBar chucNang = new JToolBar();
		chucNang.setFloatable(false);
		chucNang.setBounds(10, 53, 691, 38);
		panel.add(chucNang);

		JButton button = new JButton("Thêm");
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				btnThemSinhVien(arg0);
			}
		});
		button.setIcon(new ImageIcon(QuanLy.class.getResource("/Icon/Them.png")));
		chucNang.add(button);

		JLabel label_4 = new JLabel("  |  ");
		chucNang.add(label_4);

		JButton button_1 = new JButton("Sửa");
		button_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				try {
					btnSuaSinhVien(arg0);
				} catch (SQLException e) {
					e.printStackTrace();
				}
			}
		});
		button_1.setIcon(new ImageIcon(QuanLy.class
				.getResource("/Icon/Sua.png")));
		chucNang.add(button_1);

		JLabel label_5 = new JLabel("  |  ");
		chucNang.add(label_5);

		JButton button_3 = new JButton("Xóa");
		button_3.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				try {
					btnXoa(arg0);
				} catch (SQLException e) {
					e.printStackTrace();
				}
			}
		});
		button_3.setIcon(new ImageIcon(QuanLy.class
				.getResource("/Icon/Xoa_22.png")));
		chucNang.add(button_3);

		JLabel lblTmKim = new JLabel("  |     ");
		chucNang.add(lblTmKim);

		JLabel label_8 = new JLabel("Khóa:   ");
		chucNang.add(label_8);

		cbxKhoa = new JComboBox();
		cbxKhoa.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				setComboBoxLop();
			}
		});
		chucNang.add(cbxKhoa);

		JLabel label_9 = new JLabel("     Lớp:     ");
		chucNang.add(label_9);

		cbxLop = new JComboBox();
		chucNang.add(cbxLop);

		JLabel label_10 = new JLabel("     ");
		chucNang.add(label_10);

		JButton button_4 = new JButton("Liệt kê");
		button_4.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				try {
					btnLietKe(arg0);
				} catch (SQLException e) {
					e.printStackTrace();
				}
			}
		});
		button_4.setIcon(new ImageIcon(QuanLy.class
				.getResource("/Icon/TimKiem.png")));
		chucNang.add(button_4);
		
		label_6 = new JLabel("  |  ");
		chucNang.add(label_6);
		
		btnXemdiem = new JButton("Xem điểm");
		btnXemdiem.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent evt) {
				try {
					btn_XemDiem(evt);
				} catch (Exception e) {
					e.printStackTrace();
					JOptionPane.showMessageDialog(null,
							"Sinh viên chưa có kết quả học tập!");
				}
			}
		});
		btnXemdiem.setIcon(new ImageIcon(QuanLy.class.getResource("/Icon/month_22.png")));
		chucNang.add(btnXemdiem);

		JSeparator separator_2 = new JSeparator();
		separator_2.setBounds(10, 102, 691, 2);
		panel.add(separator_2);

		JSeparator separator_3 = new JSeparator();
		separator_3.setBounds(10, 138, 691, 2);
		panel.add(separator_3);

		JLabel label_3 = new JLabel("Danh sách sinh viên");
		label_3.setFont(new Font("Tahoma", Font.BOLD, 14));
		label_3.setBounds(273, 102, 152, 38);
		panel.add(label_3);

		JScrollPane scrollPaneStudent = new JScrollPane();
		scrollPaneStudent.setBounds(10, 150, 691, 395);
		panel.add(scrollPaneStudent);

		tblStudent = new JTable();
		scrollPaneStudent.setViewportView(tblStudent);
		jPanel1.setLayout(jPanel1Layout);

		javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
				getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(layout.createParallelGroup(
				javax.swing.GroupLayout.Alignment.LEADING).addComponent(
				jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE,
				javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
		layout.setVerticalGroup(layout.createParallelGroup(
				javax.swing.GroupLayout.Alignment.LEADING).addComponent(
				jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE,
				javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
		pack();
		Add_DanhSachUser();
	}// </editor-fold>//GEN-END:initComponents

	protected void btnLietKe(ActionEvent arg0) throws SQLException {
		loadDataStudent();
	}

	/**
	 * Load data for table
	 * 
	 * @throws SQLException
	 */
	public static void loadDataStudent() throws SQLException {
		setDataStu(((LopHoc) cbxLop.getSelectedItem()).getID(), 1, "aaa");
	}

	/**
	 * Set data for table contain list student
	 * 
	 * @throws SQLException
	 */
	public static void setDataStu(int maLop, int types, String KeyName)
			throws SQLException {
		Search_Action sa = new Search_Action();
		Vector vec = sa.DanhSachSinhVien(types, maLop, KeyName);

		TableModel absModel = new TableModel(vec, setHeaderStu(),
				TableModel.Type_DanhSachSinhVien);

		tblStudent.setModel(absModel);
		tblStudent.setRowHeight(30);

		sa.Close();
	}

	/**
	 * @return header for table
	 */
	public static Vector<String> setHeaderStu() {
		Vector<String> header = new Vector<String>();
		header.add("ID");
		header.add("Mã sinh viên");
		header.add("Tên");
		header.add("Quê quán");
		header.add("Ngày sinh");
		header.add("Giới tính");
		header.add("Tôn giáo");
		return header;
	}

	protected void btnXoa(ActionEvent arg0) throws SQLException {
		LopHoc lop = null;
		if (tblStudent.getSelectedRowCount() == 0) {
			JOptionPane.showMessageDialog(null, "Chọn Sinh viên muốn xóa !",
					"Delete ... !", JOptionPane.ERROR_MESSAGE);
		} else {
			int row = tblStudent.getSelectedRow();
			String MaSV = String.valueOf(tblStudent.getValueAt(row, 0));

			Search_Action sa = new Search_Action();
			SinhVien sv = sa.getSinhVien(MaSV);
			Delete_Action da = new Delete_Action();
			if (sa.KiemTraSVBangDiem(sv.getID()) == true) {
				int j = JOptionPane.showConfirmDialog(
						null,
						"Bạn có muốn xóa kết quả học tập của sinh viên "
								+ sv.getTen() + " không?", "Delete ... !", 2);
				if (j == 0) {
					if (da.XoaBangDiemSinhVien(sv.getID()) == true) {
						if (da.XoaSinhVien(sv.getID()) == true) {
							JOptionPane.showMessageDialog(this,
									"Xóa sinh viên thành công !", "Delete", 2);
						} else {
							JOptionPane.showMessageDialog(this,
									"Không thể xóa sinh viên", "Delete", 2);
						}
					} else {
						JOptionPane.showMessageDialog(null, "Không thể xóa!",
								"Error !", JOptionPane.ERROR_MESSAGE);
					}
				}
			} else {
				int j = JOptionPane.showConfirmDialog(null,
						"Bạn có muốn xóa sinh viên " + sv.getTen() + "?",
						"Delete ... !", 2);
				if (j == 0) {
					if (da.XoaSinhVien(sv.getID()) == true) {
						JOptionPane.showMessageDialog(this, "Xóa thành công",
								"Delete", 2);

					} else {
						JOptionPane.showMessageDialog(this,
								"Không xóa sinh vien", "Delete", 2);
					}
				}
			}
			da.Close();
			sa.Close();
		}
		loadDataStudent();
	}

	protected void btnSuaSinhVien(ActionEvent arg0) throws SQLException {
		if (tblStudent.getSelectedRowCount() == 0) {
			JOptionPane.showMessageDialog(null,
					"Chọn sinh viên bạn muốn sửa !", "Select Null !",
					JOptionPane.ERROR_MESSAGE);
		} else {
			int row = tblStudent.getSelectedRow();
			String MaSV = String.valueOf(tblStudent.getValueAt(row, 1));
			SuaSinhVien ssv = new SuaSinhVien(MaSV);
			ssv.setVisible(true);
		}
	}

	protected void btnThemSinhVien(ActionEvent arg0) {
		try {
			int row = tblStudent.getSelectedRow();
			LopHoc lop = (LopHoc) cbxLop.getSelectedItem();
			ThemSinhVien tsv = new ThemSinhVien(lop.getID());
			tsv.setVisible(true);
		} catch (Exception e) {
			JOptionPane.showMessageDialog(null, "Không được thêm sinh viên!");
		}
	}

	protected void btnHocSinh() {
		// Load data
		setComboBoxKhoa();
		try {
			loadDataStudent();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		setPanel_Body();
		pnl_SinhVien.setVisible(true);
	}

	public void setComboBoxKhoa() {
		Search_Action sa = new Search_Action();
		Vector<KhoaHoc> vectorKhoaHoc = sa.DanhSachKhoaHoc();
		for (KhoaHoc khoaHoc : vectorKhoaHoc) {
			cbxKhoa.addItem(khoaHoc);
		}
		setComboBoxLop();
	}

	public void setComboBoxLop() {
		cbxLop.removeAllItems();
		Search_Action sa = new Search_Action();
		Vector<LopHoc> vectorLopHoc = sa.DanhSachLopHoc(3,
				((KhoaHoc) cbxKhoa.getSelectedItem()).getID());
		for (LopHoc lopHoc : vectorLopHoc) {
			cbxLop.addItem(lopHoc);
		}
	}

	/**
	 * Delete course
	 * 
	 * @param evt
	 */
	private void btn_XoaKhoaHocActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btn_XoaKhoaHocActionPerformed
		// Check course is selected before delete
		if (tbl_DanhSachKhoaHoc.getSelectedRowCount() == 0) {
			JOptionPane.showMessageDialog(null, "Hãy chọn Khóa học muốn xóa !",
					"Select Null !", JOptionPane.ERROR_MESSAGE);
		} else {// Course be selected
			// Get row be selected
			int row = tbl_DanhSachKhoaHoc.getSelectedRow();
			KhoaHoc KH = (KhoaHoc) vecKhoaHoc.get(row);
			Search_Action sa = new Search_Action();
			Delete_Action da = new Delete_Action();
			int j = JOptionPane.showConfirmDialog(null,
					"Bạn có muốn xóa Khóa học này ?", "Delete ... !", 2);
			// Agree to delete
			if (j == 0) {
				if (sa.KiemTraKhoaHoc(KH.getID()) == true) {// Check whether
															// course has class
					JOptionPane.showMessageDialog(null,
							"Hãy xóa hết lớp học trong Khóa học này!",
							"Delete All !", JOptionPane.ERROR_MESSAGE);
				} else {// Course still has class
					if (da.XoaKhoaHoc(KH.getID()) == true) {
						JOptionPane.showMessageDialog(this,
								"Xóa khóa học thành công !");
						Add_DanhSachKhoaHoc();
					} else {
						JOptionPane.showMessageDialog(this,
								"Không thể xóa khóa học!");
					}
				}
			}
			// Close action
			da.Close();
			sa.Close();

		}
	}// GEN-LAST:event_btn_XoaKhoaHocActionPerformed

	/**
	 * Delete class
	 * 
	 * @param evt
	 */
	private void btn_XoaLopHocActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btn_XoaLopHocActionPerformed
		if (tbl_DanhSachLopChiTiet.getSelectedRowCount() == 0) {
			JOptionPane.showMessageDialog(null, "Hãy chọn Khóa học muốn xóa !",
					"Null Values !", JOptionPane.ERROR_MESSAGE);
		} else {
			int row = tbl_DanhSachLopChiTiet.getSelectedRow();
			int ID = Integer.parseInt(String.valueOf(tbl_DanhSachLopChiTiet
					.getValueAt(row, 0)));
			Search_Action sa = new Search_Action();
			Delete_Action da = new Delete_Action();
			int j = JOptionPane.showConfirmDialog(null,
					"Bạn có muốn xóa Lớp học này không ?", "Delete ... !", 2);
			if (j == 0) {
				if (sa.KiemTraLopHoc(ID) == true) {
					JOptionPane.showMessageDialog(null,
							"Xóa tất cả Sinh viên trong lớp !", "Delete All !",
							JOptionPane.ERROR_MESSAGE);
				} else {
					if (da.XoaLopHoc(ID) == true) {
						JOptionPane.showMessageDialog(this,
								"Xóa Lớp học thành công !");
						int row2 = tbl_DanhSachKhoaHoc.getSelectedRow();
						KhoaHoc khSelect = (KhoaHoc) vecKhoaHoc.get(row2);
						setPanel_Body();
						pnl_DanhSachLop.setVisible(true);
						lbl_KhoaHoc.setText(khSelect.getTenKhoa());
						Add_DanhSachLopHocChiTiet(1, khSelect.getID(), "aaa");
					} else {
						JOptionPane.showMessageDialog(this, "Không xóa được !");
					}
				}
			}
			da.Close();
			sa.Close();

		}
	}// GEN-LAST:event_btn_XoaLopHocActionPerformed

	private void btn_GioiThieuActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btn_GioiThieuActionPerformed
		GioiThieu gt = new GioiThieu(null, true);
		gt.setVisible(true);
	}// GEN-LAST:event_btn_GioiThieuActionPerformed

	private void btn_MonHocActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btn_MonHocActionPerformed
		QuanLyMonHoc qlmh = new QuanLyMonHoc();
			qlmh.setVisible(true);
	}// GEN-LAST:event_btn_MonHocActionPerformed

	private void btn_SuaKhoaHocActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btn_SuaKhoaHocActionPerformed
		if (tbl_DanhSachKhoaHoc.getSelectedRowCount() == 0) {
			JOptionPane.showMessageDialog(null, "Chọn Khóa học bạn muốn sửa !",
					"Select Null !", JOptionPane.ERROR_MESSAGE);
		} else {
			int row = tbl_DanhSachKhoaHoc.getSelectedRow();
			KhoaHoc KH = (KhoaHoc) vecKhoaHoc.get(row);
			SuaKhoaHoc skh = new SuaKhoaHoc(KH.getID(), KH.getTenKhoa(),
					KH.getBatDau());
			skh.setVisible(true);
		}
	}// GEN-LAST:event_btn_SuaKhoaHocActionPerformed

	private void btn_SuaNguoiDungActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btn_SuaKhoaHocActionPerformed
			if (tbl_DanhSachNguoiDung.getSelectedRowCount() == 0) {
				JOptionPane.showMessageDialog(null,
						"Chọn người dùng bạn muốn sửa !", "Select Null !",
						JOptionPane.ERROR_MESSAGE);
			} else {
				int row = tbl_DanhSachNguoiDung.getSelectedRow();
				Users user = (Users) vecUser.get(row);
				SuaNguoiDung snd = new SuaNguoiDung(user);
				pack();
				snd.setVisible(true);
			}
	}// GEN-LAST:event_btn_SuaNguoiDungActionPerformed

	private void btn_SuaLopHocActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btn_SuaLopHocActionPerformed
		if (tbl_DanhSachLopChiTiet.getSelectedRowCount() == 0) {
			JOptionPane.showMessageDialog(null, "Chọn lớp học bạn muốn sửa !",
					"Select Null !", JOptionPane.ERROR_MESSAGE);
		} else {
			int row = tbl_DanhSachLopChiTiet.getSelectedRow();
			int ID = Integer.parseInt(String.valueOf(tbl_DanhSachLopChiTiet
					.getValueAt(row, 0)));
			SuaLopHoc slh = new SuaLopHoc(ID);
			slh.setVisible(true);
		}
	}// GEN-LAST:event_btn_SuaLopHocActionPerformed

	private void btn_XemDiemActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btn_XemDiemActionPerformed
		if (tbl_DanhSachSinhVien.getSelectedRowCount() == 0) {
			JOptionPane.showMessageDialog(null, "Hãy chọn một sinh viên !",
					"Null Values !", JOptionPane.ERROR_MESSAGE);
		} else if (tbl_DanhSachSinhVien.getSelectedRowCount() == 1) {
			int row = tbl_DanhSachSinhVien.getSelectedRow();
			String MaSV = String.valueOf(tbl_DanhSachSinhVien
					.getValueAt(row, 1));
			DiemSinhVien dsv = new DiemSinhVien(MaSV);
			dsv.setVisible(true);
		}
	}// GEN-LAST:event_btn_XemDiemActionPerformed

	private void btn_XemDiem(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btn_XemDiemActionPerformed
		if (tblStudent.getSelectedRowCount() == 0) {
			JOptionPane.showMessageDialog(null, "Hãy chọn một sinh viên !",
					"Null Values !", JOptionPane.ERROR_MESSAGE);
		} else if (tblStudent.getSelectedRowCount() == 1) {
			int row = tblStudent.getSelectedRow();
			String MaSV = String.valueOf(tblStudent
					.getValueAt(row, 1));
			DiemSinhVien dsv = new DiemSinhVien(MaSV);
			dsv.setVisible(true);
		}
	}// GEN-LAST:event_btn_XemDiemActionPerformed

	private void btn_ThemLopHocActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btn_ThemLopHocActionPerformed
		try {
			int row = tbl_DanhSachKhoaHoc.getSelectedRow();
			KhoaHoc KH = (KhoaHoc) vecKhoaHoc.get(row);
			ThemLopHoc tlh = new ThemLopHoc(KH.getID());
			tlh.setVisible(true);
		} catch (Exception e) {
			JOptionPane.showMessageDialog(null,
					"Không thể thêm bất cứ mục nào tại đây!");
		}
	}// GEN-LAST:event_btn_ThemLopHocActionPerformed

	private void tbl_DanhSachLopMouseClicked(java.awt.event.MouseEvent evt) {// GEN-FIRST:event_tbl_DanhSachLopMouseClicked
		int row = tbl_DanhSachLop.getSelectedRow();
		LopHoc lop = (LopHoc) vecLopHoc.get(row);
		setPanel_Body();
		pnl_DanhSachSinhVien.setVisible(true);
		lbl_TenLop.setText(lop.getTenLop());
		Add_DanhSachSinhVien(1, lop.getID(), "aaa");
	}// GEN-LAST:event_tbl_DanhSachLopMouseClicked

	private void btn_TimKiemSinhVienActionPerformed(
			java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btn_TimKiemSinhVienActionPerformed
		String Keyname = txt_TimSinhVien.getText();
		int Type = 1;
		if (cbxSearchClass.getSelectedIndex() == 0)
			Type = 2;
		else if (cbxSearchClass.getSelectedIndex() == 1)
			Type = 3;

		int row = tbl_DanhSachLop.getSelectedRow();
		LopHoc lop = (LopHoc) vecLopHoc.get(row);
		Add_DanhSachSinhVien(Type, lop.getID(), Keyname);
		txt_TimSinhVien.setText("");
	}// GEN-LAST:event_btn_TimKiemSinhVienActionPerformed

	private void btn_ThemKhoaHocActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btn_ThemKhoaHocActionPerformed
		ThemKhoaHoc tkh = new ThemKhoaHoc();
		tkh.setVisible(true);
	}// GEN-LAST:event_btn_ThemKhoaHocActionPerformed

	private void btn_TimKiemLopActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btn_TimKiemLopActionPerformed
		String KeyName = txt_TimLopHoc.getText();
		int Type = 1;
		if (cbxSearchStudent.getSelectedIndex() == 0)
			Type = 2;
		else if (cbxSearchStudent.getSelectedIndex() == 1)
			Type = 3;
		if (cbxSearchStudent.getSelectedIndex() == 2)
			Type = 4;
		int row = tbl_DanhSachKhoaHoc.getSelectedRow();
		KhoaHoc kh = (KhoaHoc) vecKhoaHoc.get(row);
		Add_DanhSachLopHocChiTiet(Type, kh.getID(), KeyName);
		txt_TimLopHoc.setText("");
	}// GEN-LAST:event_btn_TimKiemLopActionPerformed

	private void tbl_DanhSachKhoaHocMouseClicked(java.awt.event.MouseEvent evt) {// GEN-FIRST:event_tbl_DanhSachKhoaHocMouseClicked
		int row = tbl_DanhSachKhoaHoc.getSelectedRow();
		KhoaHoc khSelect = (KhoaHoc) vecKhoaHoc.get(row);
		setPanel_Body();
		pnl_DanhSachLop.setVisible(true);
		lbl_KhoaHoc.setText(khSelect.getTenKhoa());
		Add_DanhSachLopHocChiTiet(1, khSelect.getID(), "aaa");
		// }
	}// GEN-LAST:event_tbl_DanhSachKhoaHocMouseClicked

	private void rdBtn_HeDaoTaoActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_rdBtn_HeDaoTaoActionPerformed
		Add_DanhSachLopHoc(2);
	}// GEN-LAST:event_rdBtn_HeDaoTaoActionPerformed

	private void rdBtn_KhoaHocActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_rdBtn_KhoaHocActionPerformed
		Add_DanhSachLopHoc(1);
	}// GEN-LAST:event_rdBtn_KhoaHocActionPerformed

	private void btn_LopHocActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btn_LopHocActionPerformed
		setPanel();
		pnl_LopHoc.setVisible(true);
		lbl_TenDieuKhien.setText("Lớp học");
		Add_DanhSachLopHoc(1);
	}// GEN-LAST:event_btn_LopHocActionPerformed

	private void btn_NguoiDungActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btn_HeThongActionPerformed
		setPanel();
		pnl_User.setVisible(true);
		lbl_TenDieuKhien.setText("Quản lý người dùng");
		Add_DanhSachUser();
	}// GEN-LAST:event_btn_HeThongActionPerformed

	private void btn_KhoaHocActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btn_KhoaHocActionPerformed
		setPanel();
		pnl_KhoaHoc.setVisible(true);
		lbl_TenDieuKhien.setText("Khóa học");
		Add_DanhSachKhoaHoc();
	}// GEN-LAST:event_btn_KhoaHocActionPerformed

	private void btn_Thoat1ActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btn_Thoat1ActionPerformed
		this.dispose();
		UserName = null;
		PassWord = null;
		Login lg = new Login();
		lg.setVisible(true);
	}// GEN-LAST:event_btn_Thoat1ActionPerformed

	public void setPanel() {
		pnl_User.setVisible(false);
		pnl_KhoaHoc.setVisible(false);
		pnl_LopHoc.setVisible(false);
	}

	public void setPanel_Body() {
		pnl_Default.setVisible(false);
		pnl_DanhSachLop.setVisible(false);
		pnl_DanhSachSinhVien.setVisible(false);
		pnl_SinhVien.setVisible(false);
	}

	/**
	 * @param args
	 *            the command line arguments
	 */

	// Variables declaration - do not modify//GEN-BEGIN:variables
	private javax.swing.JComboBox cbxSearchStudent;
	private javax.swing.ButtonGroup btnGR_SapXepLop;
	private javax.swing.ButtonGroup btnGR_TimKiemLop;
	private javax.swing.JButton btn_GioiThieu;
	private javax.swing.JButton btn_User;
	private javax.swing.JButton btn_KhoaHoc;
	private javax.swing.JButton btn_LopHoc;
	private javax.swing.JButton btn_MonHoc;
	private javax.swing.JButton btn_SuaKhoaHoc;
	private javax.swing.JButton btn_SuaLopHoc;
	private javax.swing.JButton btn_ThemKhoaHoc;
	private javax.swing.JButton btn_ThemLopHoc;
	private javax.swing.JButton btn_Thoat1;
	private javax.swing.JButton btn_TimKiemLop;
	private javax.swing.JButton btn_TimKiemSinhVien;
	private javax.swing.JButton btn_XemDiem;
	private javax.swing.JButton btn_XoaKhoaHoc;
	private javax.swing.JButton btn_XoaLopHoc;
	private javax.swing.JLabel jLabel1;
	private javax.swing.JLabel jLabel11;
	private javax.swing.JLabel jLabel12;
	private javax.swing.JLabel jLabel13;
	private javax.swing.JLabel jLabel15;
	private javax.swing.JLabel jLabel17;
	private javax.swing.JLabel jLabel2;
	private javax.swing.JLabel jLabel3;
	private javax.swing.JLabel jLabel4;
	private javax.swing.JLabel jLabel5;
	private javax.swing.JLabel jLabel6;
	private javax.swing.JLabel jLabel8;
	private javax.swing.JLabel jLabel9;
	private javax.swing.JPanel jPanel1;
	private javax.swing.JPanel jPanel2;
	private javax.swing.JPanel jPanel3;
	private javax.swing.JPanel jPanel4;
	private javax.swing.JPanel jPanel5;
	private javax.swing.JPanel jPanel6;
	private javax.swing.JPanel jPanel7;
	private javax.swing.JPanel jPanel8;
	private javax.swing.JPanel jPanel9;
	private javax.swing.JScrollPane jScrollPane1;
	private javax.swing.JScrollPane jScrollPane2;
	private javax.swing.JScrollPane jScrollPane3;
	private javax.swing.JScrollPane jScrollPane4;
	private javax.swing.JSeparator jSeparator1;
	private javax.swing.JToolBar jToolBar1;
	private javax.swing.JToolBar jToolBar2;
	private javax.swing.JToolBar jToolBar3;
	private javax.swing.JToolBar jToolBar4;
	private javax.swing.JToolBar jToolBar5;
	private javax.swing.JLabel lbl_HomNay;
	private javax.swing.JLabel lbl_KhoaHoc;
	private javax.swing.JLabel lbl_TenDieuKhien;
	private javax.swing.JLabel lbl_TenLop;
	private javax.swing.JLabel lbl_UserName;
	private javax.swing.JPanel pnl_DanhSachLop;
	private javax.swing.JPanel pnl_DanhSachSinhVien;
	private javax.swing.JPanel pnl_Default;
	private javax.swing.JPanel pnl_User;
	private javax.swing.JPanel pnl_KhoaHoc;
	private javax.swing.JPanel pnl_LopHoc;
	// private javax.swing.JRadioButton rdBtn_ChuNhiem;
	private javax.swing.JRadioButton rdBtn_HeDaoTao;
	private javax.swing.JRadioButton rdBtn_KhoaHoc;
	// private javax.swing.JRadioButton rdBtn_LopTruong;
	// private javax.swing.JRadioButton rdBtn_TenLop;
	private static javax.swing.JTable tbl_DanhSachKhoaHoc;
	private static javax.swing.JTable tbl_DanhSachLop;
	private static javax.swing.JTable tbl_DanhSachLopChiTiet;
	private static javax.swing.JTable tbl_DanhSachSinhVien;
	private javax.swing.JTextField txt_TimLopHoc;
	private javax.swing.JTextField txt_TimSinhVien;
	private static JTable tbl_DanhSachNguoiDung;
	private JButton button_2;
	private JComboBox cbxSearchClass;
	private JLabel lblTmSinhVin;
	private JLabel lblTmLp;
	private JLabel label;
	private JButton btnHocSinh;
	private JSeparator separator;
	private JLabel label_1;
	private JSeparator separator_1;
	private JPanel pnl_SinhVien;
	private static JTable tblStudent;
	private JPanel pnlMonHoc;
	private JButton btnXemdiem;
	private JLabel label_6;

	// End of variables declaration//GEN-END:variables

	public static void check() {
		System.out.println("Check");
	}
}
